{% extends "mall/base.html" %}

{% block title %}
    购物车
{% endblock %}

{% block css %}
    <link rel="stylesheet" href="{{ STATIC_URL }}/static/css/pad_mall/cart.css?v={{ version_code }}">
    <style>
        .u-checkout-pay .pay-content .btn-group .btn {
            width: 100%;
        }

        .u-checkout-pay .pay-content {
            width: 50%;
            margin: 0 auto;
        }
    </style>
{% endblock %}

{% block header %}
    {% include 'component/pad-suspend.html' %}

    {#    <div class="fa-hover" onclick="location.href='/pad/mall?device_id={{ device_id }}'"#}
    {#         style="font-size: 40px;width: 100px;position: fixed;right: 2%;bottom: 0;z-index: 502;"><i#}
    {#            style="color: #e4393c"#}
    {#            class="fa fa-home"#}
    {#            aria-hidden="true"></i>#}
    {#    </div>#}
{% endblock %}

{% block content %}
    <input type="hidden" name="device_id" value="{{ open_id }}">
    <div class="page" id="J-page">
        <div id="J-receiving-info">
            <div class="receiving-info">
                <div class="list" data-is-login="" data-allow-diff-warehouse="" id="J-list">
                    <a href="javascript:" class="list-item media more J-address-login set-address">
                        <div class="item-content">
                            <div class="item-inner">
                                <div class="item-title-row">
                                    <div class="item-title">
                                        设置收货地址
                                    </div>
                                </div>
                            </div>
                            <i class="icon-back"></i>
                        </div>
                    </a>
                </div>
            </div>

        </div>

        <div id="J-identify-card">
        </div>

        <div id="J-cart-info">
            <div class="shopping-cart-info-box" id="J-shopping-cart-info-box">
                <div class="section section-cart-order ui-list">
                    {% if address.sdef_address_phone %}
                        <div class="ui-list-header-item {% if cart_goods_array|length > 0 %}ui-border-b{% endif %}">
                            <h2 class="single-line">
                                收货地址： {{ address.sdef_address_province }} {{ address.sdef_address_city }} {{ address.sdef_address_county }}
                                {{ address.sdef_address_detail }}
                                【{{ address.sdef_address_name }} {{ address.sdef_address_phone }}】
                            </h2>
                        </div>
                    {% endif %}
                    <ul>
                        {% for foo in cart_goods_array %}
                            <li class="ui-list-item">
                                <input type="hidden" name="price" value="{{ foo.goods_price }}">
                                <div class="ui-list-item-inner">
                                    <a href="#"
                                       class="ui-list-item-thumb">
                                        <img src="{{ foo.goods_img }}">
                                        <!--  -->
                                    </a>

                                    <div class="ui-list-item-info">
                                        <a href="#" class="meta">
                                            <h4 class="title"> {{ foo.goods_name }}
                                            </h4>
                                        </a>

                                        <div class="stock clearfix" style="padding:0 2px;">
                                            <a href="javascript:;"
                                               class="ui-button ui-button-border ui-button-border-gray ui-button-border-small cart-count-control"
                                               data-value="-1">
                                                <i class="iconfont icon-minus"></i>
                                            </a>

                                            <span>{{ foo.count }}</span>
                                            <input class="amount-num J-amount-num" data-id="{{ foo.id }}" type="text"
                                                   readonly="readonly"
                                                   value="{{ foo.count }}" name="num">

                                            <a href="javascript:;"
                                               class="ui-button ui-button-border ui-button-border-gray ui-button-border-small J-cart-info-plus cart-count-control"
                                               data-value="1">
                                                <i class="iconfont icon-plus"></i>
                                            </a>

                                            <a href="javascript:;" class="close J-cart-info-delete">
                                                <i class="iconfont icon-close"></i>
                                            </a>
                                        </div>
                                        <a href="#" class="price">
                                            <span class="original-price">￥{{ foo.goods_price }}</span>
{#                                            <del>￥{{ foo.goods_price }}</del>#}
                                        </a>
                                    </div>
                                </div>
                            </li>
                        {% endfor %}


                    </ul>
                </div>
            </div>
        </div>

        {% if cart_goods_array|length > 0 %}
            <div id="J-checkout-money">
                <div class="J-checkout-money-wrap">
                    <ul class="u-checkout-money">
                        <li class="title ui-border-b">订单金额 <span>¥&nbsp;<b
                                class="total-price">{{ price_total }}</b></span>
                        </li>
                        <li class="item-money">商品总金额 <span>¥&nbsp;<b class="total-price">{{ price_total }}</b></span>
                        </li>
                    </ul>
                </div>

            </div>
        {% endif %}
        {% if cart_goods_array|length > 0 %}
            {% if address.sdef_address_phone %}
                <div class="u-checkout-pay checkout-pay">
                    <div class="pay-content J-pay-content border-t">
{#                        <div class="total-money">还需支付:<span>¥&nbsp;<b class="total-price">{{ price_total }}</b></span>#}
{#                        </div>#}
                        <!-- 接收银台 -->
                        <div class="btn-group clearfix">
                            <p class="disabled-delivery-msg"></p>

                            <button type="button" class="btn btn-right btn-pay-online J-online-pay">扫码支付</button>
                        </div>
                    </div>
                </div>
            {% else %}
                <div class="u-checkout-pay checkout-pay">
                    <div class="pay-content J-pay-content border-t">
                        <div class="address-tips">未设置收货地址，请先<a
                                href="javascript:" class="set-address">设置收货地址</a>
                        </div>
                    </div>
                </div>
            {% endif %}

        {% else %}
            <div class="u-checkout-pay checkout-pay">
                <div class="pay-content J-pay-content border-t">
                    <div class="total-money">购物车是空的～ <a href="/pad/mall?device_id={{ open_id }}">赶快去<b
                            style="color:blue">商城</b>选购商品吧</a></div>
                </div>
            </div>
        {% endif %}

    </div>

{% endblock %}

{% block footer %}
{% endblock %}

{% block js %}
    <script src="{{ STATIC_URL }}/static/js/pad_mall/cart.js?v={{ version_code }}"></script>
{% endblock %}